<script>
import { getShowNginxPicUrl } from "@/utils/settings"
import { showToast } from "@/utils"

export default {
  name: "copyLinkPopup",
  data() {
    return {
      link: "",
    }
  },
  methods: {
    getShowNginxPicUrl,
    open(link) {
      this.link = link
      this.$refs.copyLinkPopup.open()
    },
    copyLink() {
      uni.setClipboardData({
        data: this.link,
        success: () => {
          showToast.default("复制成功")
          this.$refs.copyLinkPopup.close()
        },
      })
    },
  },
}
</script>

<template>
  <uni-popup type="center" ref="copyLinkPopup" :is-mask-click="false">
    <view class="copy-link-popup-content">
      <image :src="getShowNginxPicUrl('KXiX7bLQ0AjzCg6tdrLU.png')" mode="widthFix" style="width: 100%" @click="copyLink"></image>
    </view>
  </uni-popup>
</template>

<style scoped lang="scss">
.copy-link-popup-content {
  width: 100vw;
}
</style>
